package com.sfzd5.mistakesbook;

import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import java.util.List;

public class ListRecyclerAdapter  extends RecyclerView.Adapter<TextViewViewHolder>{
    private List<Object> datas;
    Context context;
    LayoutInflater inflater;
    public ListRecyclerAdapter(List<Object> datas, Context context){
        this.datas = datas;
        this.context = context;
        this.inflater = LayoutInflater.from(context);
    }

    @NonNull
    @Override
    public TextViewViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = inflater.inflate(R.layout.select_recycler_item, parent, false);
        return new TextViewViewHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull TextViewViewHolder holder, int position) {
        holder.tv.setText(datas.get(position).toString());
    }

    @Override
    public int getItemCount() {
        return datas.size();
    }
}
